<!DOCTYPE html>
<html>
<head>
    <title>DOM Level 3 Load Save Example</title>
</head>
<body>
    <p>This example is known to work only in Opera.</p>
    <script type="text/javascript">
    
        var implementation = document.implementation;
        var parser = implementation.createLSParser(implementation.MODE_SYNCHRONOUS, null);
        var input = implementation.createLSInput();
        input.stringData = "<root><child/></root>";
        var xmldom = parser.parse(input);
        
        alert(xmldom.documentElement.tagName);  //"root"
        alert(xmldom.documentElement.firstChild.tagName); //"child"
        
        var anotherChild = xmldom.createElement("child");
        xmldom.documentElement.appendChild(anotherChild);
        
        var children = xmldom.getElementsByTagName("child");
        alert(children.length);   //2

    </script>
</body>
</html>
